using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EntityFX : MonoBehaviour
{

    private SpriteRenderer sr;

    [Header("Flash FX")]
    [SerializeField] private Material hihtMat;
    [SerializeField] private float flashDuration;
    private Material originalMat;

    private void Start()
    {
        sr= GetComponent<SpriteRenderer>();
        originalMat= sr.material;
    }
    private IEnumerator FlashFX()
    {
        sr.material = hihtMat;
        yield return new WaitForSeconds(flashDuration);
        sr.material = originalMat;
    }
    private void RedColorBlink()
    {
        if(sr.color!=Color.white)
            sr.color = Color.white;
        else
            sr.color = Color.red;
    }
    private void CancelRedBlink()
    {
        CancelInvoke();
        sr.color = Color.white;
    }
}
